package com.yykj.user.center.server.controller;

import com.yykj.common.dto.CreateAccountDTO;
import com.yykj.common.service.TencentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/proto/api/tencent")
@Api(tags = "腾讯云即时通讯相关接口")
public class ProtoUserAccountController {
    @GetMapping("/userSign")
    @ApiOperation(value = "获取用户UserSign",notes = "UserSig 是用户登录即时通信 IM 的密码")
    public String userSign(@RequestParam(value = "accid",required = true) String accid){
        return tencentService.getUserSign(accid);
    }

    @GetMapping("/createAccount")
    @ApiOperation(value = "创建账户",notes = "创建账户")
    public CreateAccountDTO createAccount(@RequestParam(value = "identifier",required = true) String identifier,
                                          @RequestParam(value = "nick",required = true) String nick,
                                          @RequestParam(value = "faceUrl",required = true) String faceUrl){
        return tencentService.createAccount(identifier,nick,faceUrl);
    }

    private TencentService tencentService;

    @Autowired
    public void setTencentService(TencentService tencentService) {
        this.tencentService = tencentService;
    }


}
